#include "883.h"

int readKey(char* key)
{
	//serialPort1.Write("s5CB\n");
	char c = 'x';
	putstr("s5CB\n");
	while('\r' != c){
		c = getch();
		if('n' == c)
			return -1;
		*key++ = c;
	}
	return 0;
}

int readCryptoKey(char key[])
{
	//serialPort1.Write("s7C9\n");
	char c = 'x';
	putstr("s7C9\n");
	while('\r' != c){
		c = getch();
		if('n' == c)
			return -1;
		*key++ = c;
	}
	return 0;
}

int writeCryptoKey(char* key)
{
	/*
	 * private void buttonWriteCrypto_Click(object sender, EventArgs e)
        {
            System.Text.Encoding enc = System.Text.Encoding.UTF8;
            byte[] buffer1 = new byte[33];
            Array.Copy(enc.GetBytes("s6D9"), 0, buffer1, 0, 4);
            Array.Copy(enc.GetBytes(textBoxOut.Text), 0, buffer1, 4, 26);
            buffer1[30]=Convert.ToByte(Checksum("6D9"+textBoxOut.Text)[0]);
            buffer1[31] = Convert.ToByte(Checksum("6D9" + textBoxOut.Text)[1]);
            buffer1[32] = 0x0D;

            
             //MessageBox.Show(enc.GetString(buffer1, 0, 33));
             serialPort1.Write(buffer1, 0, 33);
        }
	 */
}

int readTrasponder(char* key)
{
	return 0;
}
